# 作者: 家里蹲 吴越洋
# 2023年03月08日17时47分23秒

from socket import *
import struct

server_socket=socket(AF_INET,SOCK_STREAM)
server_socket.bind(('',3000))
server_socket.listen(10)
client_socket,client_addr=server_socket.accept()

# 发文件名
file_name='file'
b_file_name=file_name.encode('utf8')
client_socket.send(struct.pack('I',len(b_file_name)))
client_socket.send(b_file_name)

# 发文件内容
file=open(file_name,'rb')
file_content=file.read()
client_socket.send(struct.pack('I',len(file_content)))
client_socket.send(file_content)
file.close()

client_socket.close()
server_socket.close()